home *** CD-ROM | disk | FTP | other *** search
- Using PopUp Menus
-
- files: popup_menu.h, popup_menu.c
-
- Initializing the PopUp Menu Package:
-
- - make sure your program has opened the Intuition, Graphics, Layers
- libraries
-
- - call Init_MenuPackage
-
- - if Init_MenuPackage returns FALSE, something went wrong so don't
- use the menu package ...exit while you can
-
- - create your popup menus (see below)
-
- - make sure that your window asks Intution to update its
- MouseX and MouseY coordinates by setting REPORTMOUSE flag in
- your window or calling ReportMouse(Window, TRUE).
-
- - set the MOUSEBUTTONS IDCMP flag in your window structure so that
- your program will be notified when the mouse buttons are pressed.
-
- - if you want your popup menu to be activated on a right mouse button,
- make sure that you set the RMBTRAP flag in your window
-
-
- Creating a PopUp Menu:
-
- - initialize a PopUp_Menu structure
-
- - call Init_PopUp_Menu
-
- - if Init_PopUp_Menu returns FALSE, the initialization routine failed
- so don't use the popup menu
-
-
- Popping Up a Menu:
-
- - wherever you receive your IDCMP messages, check for the
- MOUSEBUTTONS event and if the IDCMP message contains the
- Code to select your menu (SELECTDOWN if you want your menu
- activated on left mouse button, MENUDOWN for right mouse
- button) then...
-
- - call PopUp with the menu that you want to appear and the window
- that you want it to appear on. The menu will appear under the
- window's current mouse position.
-
- - PopUp will return when the user has deactivated the menu. PopUp
- will return the selection_id of the item the user has selected.
- If no item was selected when the menu was deactivated then PopUp
- will return NOITEM_SELECTED. If the cursor was outside of the
- window, PopUp will return OUTSIDE_WINDOW. Note: selection_ids
- should be >= 0 so that they don't conflict with NOITEM_SELECTED
- or OUTSIDE_WINDOW.
-
-
- Closing Everything:
-
- To ensure that all of the memory consumed by your popup menus
- (and the popup menu package itself) is released, you should:
-
- - call Dispose_PopUp with each popup menu that you have initialized
-
- - call Close_Menu_Package
-
-
- BUGS: doesn't support GIMMEZEROZERO windows
-
-